package com.ssh.dao;

import java.util.List;

import com.ssh.model.OntologyFile;
import com.ssh.model.Users;


import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class OntologyFileDAO extends HibernateDaoSupport implements IOntologyFileDAO{

	
	public void save(OntologyFile transientInstance) {
		
		try {
			getHibernateTemplate().save(transientInstance);
			
		} catch (RuntimeException re) {
			
			throw re;
		}
	}

	
	public void delete(OntologyFile persistentInstance) {
		
		try {
			getHibernateTemplate().delete(persistentInstance);
		
		} catch (RuntimeException re) {
		
			throw re;
		}
	}
	public OntologyFile findById(java.lang.Integer id) {
		
		try {
			OntologyFile instance = (OntologyFile) getHibernateTemplate().get(
					"com.ssh.model.OntologyFile", id);
			return instance;
		} catch (RuntimeException re) {
			
			throw re;
		}
	}

	@SuppressWarnings("unchecked")
	public List<OntologyFile> findByProperty(String propertyName, Object value) {
	
		try {
			String queryString = "from OntologyFile as model where model."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			
			throw re;
		}
	}
	public List<OntologyFile> findByOwnerName(String ownerName) {
		
	    return findByProperty(ONTOLOGYNAME,ownerName);
	}

	@SuppressWarnings("unchecked")
	public List<OntologyFile> findAll() {
		
		try {
			String queryString = "from OntologyFile";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			
			throw re;
		}
	}
}
